<template>
	<view class="custom">
		<view class="box">
			<view class="left">
				<fui-icon color="#000000" name="search" size="48rpx"></fui-icon>
				<input class="input" :value="value" confirm-type="search" :placeholder="placeholder" @input="onKeyInput"
					@confirm="onSerach" />
			</view>

			<text class="text" @click="onSerach">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			placeholder: String,
			value: String,
		},
		data() {
			return {
				v: null
			}
		},
		emits: ['search'],
		methods: {
			onKeyInput(val) {
				this.v = val;
			},
			onSerach() {
				this.$emit('search', this.v)
			},

		}
	}
</script>

<style lang="scss" scoped>
	.custom {
		background-color: #fff;
		padding: 16rpx;

		.box {
			display: flex;
			align-items: center;
			justify-content: center;

			.left {
				background-color: #f3f3f3;
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				padding: 16rpx;
				border-radius: 12rpx 12rpx 12rpx 12rpx;

				.icon {}

				.input {
					flex: 1;
					padding-left: 16rpx;
					padding-right: 16rpx;
					font-size: 32rpx;
					font-weight: 400;
					color: #000
				}
			}


			.text {
				font-size: 32rpx;
				font-weight: 400;
				color: #0052D9;
				padding-left: 16rpx;
			}
		}

		&-icon {}
	}
</style>